<template>
  <div class="box">
    <div class="dv">
      <van-nav-bar title="京东电器">
        <template #left>
          <van-icon name="arrow-left" size="20" color="#252525" @click="fun1" />
        </template>
        <template #right>
          <van-icon
            name="bars"
            size="26"
            color="#252525"
            style="margin-right: 6px"
            @click="fun2"
          />
          <van-icon
            name="ellipsis"
            size="26"
            color="#252525"
            style="margin-left: 6px"
            @click="fun"
          />
          <div class="box1" v-if="flag">
            <div class="dv1">
              <p><van-icon name="home-o" size="17" /></p>
              <div>首页</div>
            </div>
            <div class="dv1">
              <p><van-icon name="apps-o" size="17" /></p>
              <div>分类搜索</div>
            </div>
            <div class="dv1">
              <p><van-icon name="cart-o" size="17" /></p>
              <div>购物车</div>
            </div>
            <div class="dv1">
              <p><van-icon name="contact" size="17" /></p>
              <div>我的京东</div>
            </div>
            <div class="dv1">
              <p><van-icon name="browsing-history-o" size="17" /></p>
              <div>浏览记录</div>
            </div>
            <div class="dv1">
              <p><van-icon name="share-o" size="17" /></p>
              <div>分享</div>
            </div>
          </div>
        </template>
      </van-nav-bar>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      flag: false,
    };
  },
  methods: {
    fun() {
      this.flag = !this.flag;
    },
    // 跳转到home页面
    fun1() {
      this.$router.back();
    },
    // 跳转到分类页面
    fun2() {
      this.$router.push("/ClassifyPage");
    },
  },
};
</script>

<style scoped>
.box1 {
  width: 125px;
  height: 240px;
  /* background-color: #eee; */
  background-color: black;
  opacity: 0.9;
  border-radius: 5px;
  position: absolute;
  top: 44px;
  right: 10px;
  z-index: 999;
}
.box1 .dv1 {
  display: flex;
  width: 125px;
  height: 40px;
  color: #fff;
  font-size: 14px;
}
.dv1 div {
  border-bottom: 1px solid #eee;
  width: 85px;
  line-height: 40px;
}

.dv1 p {
  width: 40px;
  text-align: center;
}
</style>